using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using WozLib.UI.Ink.SketchObjects;

namespace WozLib.UI.Ink.SketchProperties
{
  public class OpacitySketchProperty : SketchProperty
  {

    [XmlElement("Opacity")]
    public double Data
    {
      get { return _Data; }
      set
      {
        if (value != _Data)
        {
          _Data = value;

          FirePropertyChanged("Data");
          NotifyPropertyChanged();
        }
      }
    } private double _Data;

    public OpacitySketchProperty(double data)
      : base(WozPropertyType.Opacity)
    {
      Data = data;
    }

    public OpacitySketchProperty()
      : base(WozPropertyType.Opacity)
    {
    }

    // Thickness is not cloneable
    // maybe we need to make a new one?
    public override object Clone()
    {
      return new OpacitySketchProperty(Data);
    }

    /// <summary>
    /// Returns true if .equals on the thickness Data is true
    /// </summary>
    /// <param name="obj"></param>
    /// <returns></returns>
    public override bool Equals(object obj)
    {
      if (obj is OpacitySketchProperty && (obj as OpacitySketchProperty).Data == Data)
      {
        return true;
      }
      else
      {
        return false;
      }
    }

    public override CascadingProperty CreateCascadingProperty(List<ISketchObject> iWozObjects)
    {
      return new OpacityCascadingProperty(iWozObjects, this);
    }
  }
}